home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Printer Drivers… / LaserWriterIIsc (New GX v1.1) / UniversalMessageResources.r < prev    next >
Encoding:
Text File  |  1996-06-15  |  17.1 KB  |  511 lines  |  [TEXT/MPS ]

  1. /* ------------------------------------------------------------------------------
  2. FILENAME
  3.     NewAPIResources.r
  4.  
  5. DESCRIPTION
  6.     This module contains the LaserWriter SC constants, types, and resources that
  7.     are specific to supporting the New (QuickDraw GX) API.
  8.             
  9.     Note: all resources should be designated to load into the system heap.
  10.  
  11. COPYRIGHT
  12.      Copyright Apple Computer, Inc. 1988-1996
  13.      All rights reserved. 
  14.  
  15. MODIFICATION HISTORY
  16.      6/14/96 - cn  - Updated to support Universal Interfaces 2.1.
  17.  
  18. -------------------------------------------------------------------------------- */
  19.  
  20. // System 7.0 Compatible
  21. #define SystemSevenOrLater        1
  22.  
  23. // Include System Resource Definitions
  24. #include "Types.r"
  25. #include "SysTypes.r"
  26.  
  27. // Include the LaserWriter SC driver constants that are used in the resources 
  28. #include "LaserSCResources.h"
  29.  
  30. // Include the public QuickDraw GX printing files 
  31. #include "GXPrintingResTypes.r"
  32.  
  33.  
  34. /*********************************************************************************
  35.  *                                RESOURCES                                                              *
  36.  *********************************************************************************/
  37.  
  38.  
  39. /*************************** Universal Imaging Message Override Resource **************************/
  40. // This overrideType resource tells the Printing Manager which new Universal Imaging 
  41. // Messages the driver overrides. 
  42.  
  43. resource gxOverrideType (gxDriverUniversalOverrideID, sysheap)
  44. {
  45.     {
  46.         gxInitialize,            kNewAPISegmentID, kFirstMsgJumpTableOffset,
  47.         gxShutDown,             kNewAPISegmentID, kFirstMsgJumpTableOffset +  4,
  48.         gxSetupPageImageData,kNewAPISegmentID, kFirstMsgJumpTableOffset +  8,
  49.         gxSetUpImageData,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 12,
  50.         gxOpenConnection,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 16,
  51.         gxCloseConnection,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 20,
  52.         gxStartSendPage,         kNewAPISegmentID, kFirstMsgJumpTableOffset + 24,
  53.         gxFinishSendPage,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 28,
  54.         gxDefaultPrinter,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 32,
  55.         gxWriteData,             kNewAPISegmentID, kFirstMsgJumpTableOffset + 36,
  56.         gxCheckStatus,            kNewAPISegmentID, kFirstMsgJumpTableOffset + 40,
  57.         gxGetDeviceStatus,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 44,
  58.         gxCreateImageFile,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 48,
  59.         gxFetchTaggedData,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 52,
  60.         gxDoesPaperFit,        kNewAPISegmentID, kFirstMsgJumpTableOffset + 60
  61.     };
  62. };
  63.  
  64.  
  65. /*************************** Raster Imaging Message Override Resource **************************/
  66. // This overrideType resource tells the Printing Manager which Raster Imaging Messages the driver 
  67. // overrides. 
  68.  
  69. resource gxOverrideType (gxDriverImagingOverrideID, sysheap)
  70. {
  71.     {
  72.         gxRasterDataIn,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 56
  73.     };
  74. };
  75.  
  76.  
  77. /*************************** Type of Imaging System Supported by the Driver **************************/
  78. // This imagingSystemResType resource tells the Printing Manager the type of imaging system this 
  79. // driver uses.
  80.  
  81. resource gxImagingSystemSelectorType (gxImagingSystemSelectorID, sysheap)
  82. {
  83.     gxRasterPrinterType        // LaserWriter SC uses the raster imaging system 
  84. };
  85.  
  86.  
  87. /*************************** Customizing Behavior of Raster Imaging Messages ***************************/
  88. // For most raster devices, the driver should include a resource of type, rasterPrefsType.  This 
  89. // resource allows the driver to specify the imaging options and format page scaling.  Since 
  90. // the Printing Manager default rasterPrefsType resource is defined for a 1 bit, 300 dpi device, 
  91. // the LaserWriter SC driver uses this default. 
  92.  
  93.  
  94. /*************************** I/O Related Resources ***************************/
  95.  
  96. // This universalIOPrefsType resource controls the behavior of the standard buffering and IO 
  97. // within the Universal Driver. 
  98.  
  99. resource gxUniversalIOPrefsType (gxUniversalIOPrefsID, sysheap)
  100. {
  101.         standardIO,
  102.         0,                // Universal Driver will not allocate any buffers 
  103.         0,                // size of the buffers allocated (N/A) 
  104.         10,            // number of I/O request blocks to allocate for the Universal Driver's I/O 
  105.         1200,            // 1200 tick timeout for open/close 
  106.         1200,            // 1200 tick timeout for reading and writing 
  107. };
  108.     
  109.  
  110. /*************************** Status Dialog Related Resources ***************************/
  111. // The 'stat' resources provide the Printing Manager the status messages that need to be displayed at
  112. // any given time during the printing process. The driver forces statuses to be displayed by calling 
  113. // either ReportStatus or AlertTheUser, depending upon whether the user needs to make some decision 
  114. // about the printing process (e.g. paper tray not properly loaded. Note that though the statID field
  115. // of the 'stat' resource is for the clients use (us), PrinterShare requires that any 'stat' list
  116. // entry that has the same status type (e.g. informationalStatus) must have a unique statID.  The reason
  117. // is that PrinterShare uses the (status type, statID) pair in comparisons to see if the status has
  118. // changed.
  119.  
  120. resource 'stat' (kTransmissionStatID, sysheap)         // Page transmission 'stat' - informational messages only 
  121. {
  122.     kDrvrCreatorType,
  123.     {
  124.         informationalStatus,     1,        kNoAlertCoolID,                 "Waiting for the next sheet of paper…";
  125.         informationalStatus,        2,        kNoAlertCoolID,                "Sending part of the page…";
  126.         informationalStatus,        3,        kNoAlertCoolID,                "Preparing part of the page…";
  127.         informationalStatus,     4,        kNoAlertCoolID,                 "The printer is out of paper.";
  128.         informationalStatus,     5,        kNoAlertCoolID,                 "The printer has a paper jam.";
  129.         informationalStatus,     6,        kNoAlertCoolID,                "The paper tray is improperly loaded.";
  130.         userAlert,                     7,     kPrinterDoorOpenCoolID,        "The printer door is open.  Please close it.";
  131.         informationalStatus,     8,     kNoAlertCoolID,                "The printer door is open.  Please close it.";    //    Non-alert instance of the status
  132.         informationalStatus,     9,     kNoAlertCoolID,                "A print test is in progress.  Please wait…";
  133.         informationalStatus,     10,    kNoAlertCoolID,                "The printer fixing unit is being heated.  Please wait…";
  134.         userAlert,                    11,    kBadTonerCartridgeCoolID,    "The toner cartridge is improperly loaded.";
  135.         informationalStatus,        12,    kNoAlertCoolID,                "The toner cartridge is improperly loaded.";        //    Non-alert instance of the status
  136.         pageTransmission,             13,    kNoAlertCoolID,                "Printing the page.";
  137.         userAlert,                     14,    kCantFindPrinterCoolID,        "Trying to locate the printer…";
  138.         openConnectionStatus,     15,    kNoAlertCoolID,                "Opening a connection to the printer…";
  139.     }
  140. };
  141.  
  142. resource 'stat' (kEngineStatusStatID, sysheap)        // Printer engine status 'stat' - fatal errors 
  143. {
  144.     kDrvrCreatorType,
  145.     {
  146.         userAlert,            1,    kLaserInitFailureCoolID,    "Laser Printer engine initialization failed.";
  147.         userAlert,            2,    kDRamFailureCoolID,            "Dynamic Ram test failure.";
  148.         userAlert,             3,    kBadPrintFixCoolID,             "The printer fixing assembly has malfunctioned.";
  149.         userAlert,             4,    kBadLaserCoolID,                 "The printer laser has malfunctioned.";
  150.         userAlert,             5,    kBadPolyMotorCoolID,         "The printer polygon motor has malfunctioned.";
  151.         userAlert,             6,    kBadSerialCoolID,             "The printer has a serial communication malfunction.";
  152.         userAlert,             7,    kGenericBadHdwareCoolID,     "The printer has a hardware malfunction.";
  153.         userAlert,            8, kBadVersionAlertID,            "Printer driver requires QuickDraw™ GX version 1.1 or later.";
  154.     }
  155. };
  156.  
  157.  
  158.  
  159. // Following are the gxPrintingAlertType alert definitions which are used to notify the user of FATAL printing errors. 
  160.  
  161. // This is our "this driver requires QDGX 1.1" alert.
  162.  
  163. resource gxPrintingAlertType (kBadVersionAlertID, sysheap)
  164. {
  165.     printingStatus,                                            // version 
  166.     stopIcon,                                                    // icon id 
  167.     defaultSystemSize,
  168.     defaultAction,                                                // the default label 
  169.     noCancelTitle,                                                // haven't got a cancel 
  170.     "The “LaserWriterIISC GX” printer driver "
  171.     "cannot be used because it requires "
  172.     "QuickDraw™ GX version 1.1 or later.",             // text string 
  173.     "Cancel",                                                    // action label 
  174.     "",                                                            // button label 2 
  175.     "",                                                            // button label 3 
  176.     " ",                                                            // font name 
  177.     "Printer Driver Version Error"
  178. };
  179.  
  180.  
  181. // ...and this is what we use if we're running from the Chooser instead of the Finder.
  182.  
  183. resource 'dctb' (kBadVersionDLOG, sysheap) {
  184.     {}
  185. };
  186.  
  187. resource 'ALRT' (kBadVersionDLOG, sysheap) {
  188.     {40, 40, 162, 392},
  189.     kBadVersionDLOG,
  190.     {
  191.         OK, visible, sound1,
  192.         OK, visible, sound1,
  193.         OK, visible, sound1,
  194.         OK, visible, sound1
  195.     },
  196.     alertPositionParentWindow
  197. };
  198.  
  199. resource 'DITL' (kBadVersionDLOG, sysheap) {
  200.     {
  201.         {92, 281, 112, 339},
  202.         Button {
  203.             enabled,
  204.             "OK"
  205.         },
  206.         {8, 80, 74, 345},
  207.         StaticText {
  208.             disabled,
  209.             "The printer driver “^0” cannot be used "
  210.             "because it requires QuickDraw™ GX version "
  211.             "1.1 or later."
  212.         }
  213.     }
  214. };
  215.  
  216.  
  217. resource gxPrintingAlertType (kLaserInitFailureCoolID, sysheap)        // Laser Printer initialization failed 
  218. {
  219.     printingStatus,                                                // version 
  220.     stopIcon,                                                    // icon id 
  221.     defaultSystemSize,
  222.     defaultAction,                                                // the default label 
  223.     noCancelTitle,                                                // haven't got a cancel 
  224.     "The document !1 failed to print, because the printer !0 failed to initialize.",            // text string 
  225.     "Cancel Printing",                                        // action label 
  226.     "",                                                            // button label 2 
  227.     "",                                                            // button label 3 
  228.     " ",                                                            // font name 
  229.     "Printer Failure"
  230. };
  231.  
  232.  
  233. resource gxPrintingAlertType (kDRamFailureCoolID, sysheap)        // Dynamic Ram test failure 
  234. {
  235.     printingStatus,                                                    // version 
  236.     stopIcon,                                                    // icon id 
  237.     defaultSystemSize,
  238.     defaultAction,                                                // the default label 
  239.     noCancelTitle,                                                // haven't got a cancel 
  240.     "The document !1 failed to print, because the printer !0 experienced a dynamic RAM failure.",    // text string 
  241.     "Cancel Printing",                                        // action label 
  242.     "",                                                            // button label 2 
  243.     "",                                                            // button label 3 
  244.     " ",                                                            // font name 
  245.     "Printer Failure"
  246. };
  247.  
  248.  
  249. resource gxPrintingAlertType (kBadPrintFixCoolID, sysheap)         // printer fixing assembly bad 
  250. {
  251.     printingStatus,                                                    // version 
  252.     stopIcon,                                                    // icon id 
  253.     defaultSystemSize,
  254.     defaultAction,                                                // the default label 
  255.     noCancelTitle,                                                // haven't got a cancel 
  256.     "The document !1 failed to print, because the fixing assembly in the printer !0 has malfunctioned.",  // text string 
  257.     "Cancel Printing",                                        // action label 
  258.     "",                                                            // button label 2 
  259.     "",                                                            // button label 3 
  260.     " ",                                                            // font name 
  261.     "Printer Failure"
  262. };
  263.  
  264. resource gxPrintingAlertType (kBadLaserCoolID, sysheap)         // laser bad 
  265. {
  266.     printingStatus,                                                    // version 
  267.     stopIcon,                                                    // icon id 
  268.     defaultSystemSize,
  269.     defaultAction,                                                // the default label 
  270.     noCancelTitle,                                                // haven't got a cancel 
  271.     "The document !1 failed to print, because the laser in the printer !0 has malfunctioned.",    // text string 
  272.     "Cancel Printing",                                        // action label 
  273.     "",                                                            // button label 2 
  274.     "",                                                            // button label 3 
  275.     " ",                                                            // font name 
  276.     "Printer Failure"
  277. };
  278.  
  279. resource gxPrintingAlertType (kBadPolyMotorCoolID, sysheap)         // polygon motor bad 
  280. {
  281.     printingStatus,                                                    // version 
  282.     stopIcon,                                                    // icon id 
  283.     defaultSystemSize,
  284.     defaultAction,                                                // the default label 
  285.     noCancelTitle,                                                // haven't got a cancel 
  286.     "The document !1 failed to print, because the polygon motor in the printer !0 has malfunctioned.",    // text string 
  287.     "Cancel Printing",                                        // action label 
  288.     "",                                                            // button label 2 
  289.     "",                                                            // button label 3 
  290.     " ",                                                            // font name 
  291.     "Printer Failure"
  292. };
  293.  
  294. resource gxPrintingAlertType (kBadSerialCoolID, sysheap)         // serial communication bad 
  295. {
  296.     printingStatus,                                                    // version 
  297.     stopIcon,                                                    // icon id 
  298.     defaultSystemSize,
  299.     defaultAction,                                                // the default label 
  300.     noCancelTitle,                                                // haven't got a cancel 
  301.     "The document !1 failed to print, because a serial communication malfunction has occurred in the printer !0.",    // text string 
  302.     "Cancel Printing",                                        // action label 
  303.     "",                                                            // button label 2 
  304.     "",                                                            // button label 3 
  305.     " ",                                                            // font name 
  306.     "Printer Failure"
  307. };
  308.  
  309. resource gxPrintingAlertType (kGenericBadHdwareCoolID, sysheap)         // unidentified hardware malfunction 
  310. {
  311.     printingStatus,                                                    // version 
  312.     stopIcon,                                                    // icon id 
  313.     defaultSystemSize,
  314.     defaultAction,                                                // the default label 
  315.     noCancelTitle,                                                // haven't got a cancel 
  316.     "The document !1 failed to print, because the printer !0 experienced an unknown hardware malfunction.",    // text string 
  317.     "Cancel Printing",                                        // action label 
  318.     "",                                                            // button label 2 
  319.     "",                                                            // button label 3 
  320.     " ",                                                            // font name 
  321.     "Printer Failure"
  322. };
  323.  
  324. // Following are the gxPrintingAlertType alert definitions which are used to notify the user of NON-FATAL printing errors. 
  325.  
  326. resource gxPrintingAlertType (kPrinterDoorOpenCoolID, sysHeap)            //    The printer's door is open so we can't print
  327. {
  328.     printingStatus,                                                                // version
  329.     cautionIcon,                                                            // icon id
  330.     defaultSystemSize,
  331.     defaultAction,                                                            // the default label
  332.     cancelTitle2,                                                            // second button is cancel
  333.      "The printer door on the printer !0 is open.  To "        // text string
  334.      "continue printing !1, please close the door and "        // text string
  335.      "click Continue.  If you wish to cancel printing, "       // text string
  336.      "please click Cancel Printing.",                                   // text string
  337.      "Continue",                                                                // action label
  338.     "Cancel Printing",                                                    // button label 2
  339.     "",                                                                        // button label 3
  340.     " ",                                                            // font name 
  341.     "Printer Failure"
  342. };
  343.  
  344. resource gxPrintingAlertType (kBadTonerCartridgeCoolID, sysHeap)        //    The printer's toner cartridge is not inserted properly
  345. {
  346.     printingStatus,                                                                // version
  347.     cautionIcon,                                                            // icon id
  348.     defaultSystemSize,
  349.     defaultAction,                                                            // the default label
  350.     cancelTitle2,                                                            // second button is cancel
  351.      "The toner cartridge in the printer !0 is improperly "    //
  352.     "loaded.  To continue printing !1, please re-install "    //
  353.     "the cartridge properly and click Continue.  "
  354.      "If you wish to cancel printing, "                               // text string
  355.      "please click Cancel Printing.",                                   // text string
  356.      "Continue",                                                                // action label
  357.     "Cancel Printing",                                                    // button label 2
  358.     "",                                                                        // button label 3
  359.     " ",                                                                        // font name 
  360.     "Printer Failure"
  361. };
  362.  
  363. resource gxPrintingAlertType (kCantFindPrinterCoolID, sysHeap)            //    The printer can't be found on the SCSI bus
  364. {
  365.     printingStatus,                                                                // version
  366.     cautionIcon,                                                            // icon id
  367.     defaultSystemSize,
  368.     defaultAction,                                                            // the default label
  369.     noCancelTitle,                                                            // no cancel
  370.     "The document !1 cannot be printed, because the printer "
  371.      "!0 cannot be found.  To continue printing, please make "
  372.     "sure the printer is "
  373.     "properly connected and turned on.  If you wish "    
  374.     "to cancel printing, please click Cancel Printing.",
  375.      "Cancel Printing",                                                    // action label
  376.     "",                                                                        // button label 2
  377.     "",                                                                        // button label 3
  378.     " ",                                                                        // font name 
  379.     "Printer Not Found"
  380. };
  381.  
  382.  
  383. /*************************** Paper Type Definitions for the New Printing Architecture **************************/
  384. // These paper type definitions represent the new settings for the LaserWriter SC's paper 
  385. // sizes. 
  386.  
  387. resource 'ptyp' (kNewPaperTypesID + 1, sysheap)            // US Letter 
  388. {
  389.     "US Letter",
  390.     
  391.     // page rectangle 
  392.     0x00000000,                // 8.0 x 10.583
  393.     0x00000000,                
  394.     0x02400000,                
  395.     0x02F9F9B8,                
  396.  
  397.     // paper rectangle 
  398.     0xFFEE0000,                // 8.5 x 11.0
  399.     0xFFF0FCDC,                
  400.     0x02520000,                
  401.     0x0308FCDC,                
  402.     
  403.     usLetterBase,
  404.     kDrvrCreatorType,
  405.  
  406.     inch,
  407.     newStylePaperType,
  408.     isDefaultPaperType,
  409.     {}
  410. };
  411.  
  412. resource 'ptyp' (kNewPaperTypesID + 2, sysheap)            // US Legal 
  413. {
  414.     "US Legal",
  415.     
  416.     // page rectangle 
  417.     0x00000000,                // 6.67 x 12.5
  418.     0x00000000,                
  419.     0x01E03D68,                    
  420.     0x03840000,                
  421.  
  422.     // paper rectangle 
  423.     0xFFBE1EB4,                // 8.5 x 14.0
  424.     0xFFCA0000,                
  425.     0x02221EB4,                
  426.     0x03BA0000,                
  427.     
  428.     usLegalBase,
  429.     kDrvrCreatorType,
  430.  
  431.     inch,
  432.     newStylePaperType,
  433.     notDefaultPaperType,
  434.     {}
  435. };
  436.  
  437. resource 'ptyp' (kNewPaperTypesID + 3, sysheap)            // A4 Letter 
  438. {
  439.     "A4 Letter",
  440.     
  441.     // page rectangle 
  442.     0x00000000,                // 8.0 x 11.25 
  443.     0x00000000,
  444.     0x02400000,
  445.     0x032A0000,
  446.  
  447.     // paper rectangle 
  448.     0xFFF70000,                //    8.25 x 11.6667
  449.     0xFFF0FFAC,
  450.     0x02490000,
  451.     0x03390054,
  452.     
  453.     a4LetterBase,
  454.     kDrvrCreatorType,
  455.  
  456.     inch,
  457.     newStylePaperType,
  458.     notDefaultPaperType,
  459.     {}
  460. };
  461.  
  462. resource 'ptyp' (kNewPaperTypesID + 4, sysheap)            // B5 Letter 
  463. {
  464.     "B5 Letter",
  465.     
  466.     // page rectangle 
  467.     0x00000000,                // 6.6667 x 9.4167 
  468.     0x00000000,                
  469.     0x01DFC290,                
  470.     0X02C251EC,                
  471.  
  472.     // paper rectangle 
  473.     -0x14A3D7,                // 6.9306 x 9.8333
  474.     -0x73338,                
  475.     0x01F46667,                
  476.     0x02C98524,                
  477.     
  478.     b5LetterBase,
  479.     kDrvrCreatorType,
  480.  
  481.     inch,
  482.     newStylePaperType,
  483.     notDefaultPaperType,
  484.     {}
  485. };
  486.  
  487. resource 'ptyp' (kNewPaperTypesID + 5, sysheap)            // Nº 10 Envelope 
  488. {
  489.     "Nº 10 Envelope",
  490.     
  491.     // page rectangle 
  492.     0x00000000,                    // 9.083 x 3.78 
  493.     0x00000000,                    
  494.     0x011028F0,                    
  495.     0x028DF9B8,                    
  496.     
  497.     // paper rectangle 
  498.     0xFFF39478,                    // 9.5 x 4.125 
  499.     0xFFF0FCDC,                    
  500.     0x011C9478,                    
  501.     0x029CFCDC,                    
  502.     
  503.     unknownBase,
  504.     kDrvrCreatorType,
  505.  
  506.     inch,
  507.     newStylePaperType,
  508.     notDefaultPaperType,
  509.     {}
  510. };
  511.